package com.mapper;

import com.pojo.Orders;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author xin
* @description 针对表【tb_orders】的数据库操作Mapper
* @createDate 2024-11-14 15:15:50
* @Entity com.pojo.Orders
*/
public interface OrdersMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Orders record);

    int insertSelective(Orders record);

    Orders selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Orders record);

    int updateByPrimaryKey(Orders record);

    Orders findOrdersWithPorduct(Integer id);

    @Select("SELECT * FROM tb_orders WHERE user_id = #{id}")
    @Results({@Result(id = true,column = "id", property = "id"),
            @Result(column = "number", property = "number")
    })
    List<Orders> selectOrdersByUserId(int user_id);
}
